#!/bin/bash
influxdb=`which influxdb`
current_influx=influxdb_1.8.3
if [ -z ${influxdb} ];then
    url=https://dl.influxdata.com/influxdb/releases/${current_influx}_amd64.deb 
	package_name=`basename ${url}`
	saved_package=/tmp/${package_name}
	if [ ! -f ${saved_package} ];then
	    wget -c ${url} -O ${saved_package}
        sudo dpkg -i ${saved_package}
		sudo service influxd start
	fi
else
	echo ${influxdb}
fi
